package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ReportMapper extends BaseMapper {
    @Select("SELECT count(mt.id) as totalCounts,concat(year(now())-1,\"-\",rd.fmonth) as yearAndMonth " +
            "FROM  member_t mt, rpt_date rd " +
            "WHERE  mt.create_date = rd.fdate and  rd.fyear = year(now())-1 " +
            "group by month(mt.create_date)")
    List<Map> totalMemberCounts();

    @Select("SELECT count(st.id) as value,st.name as name " +
            "FROM setmeal_t st,order_t ort " +
            "WHERE ort.setmeal_id = st.id " +
            "group by st.id")
    List<Map> orderSetmealProportion();
}
